package com.copa.module.user.manage.impl;

import cn.hutool.core.util.ObjectUtil;
import com.copa.domain.ResponseDto;
import com.copa.module.user.domain.dto.UserAddressDto;
import com.copa.module.user.manage.UserAddressManage;
import com.copa.module.user.mapper.UserAddressDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author copa
 * @createDate 2021-01-05 14:06
 * @function
 */
@Service
public class UserAddressManageImpl implements UserAddressManage {

    @Autowired
    private UserAddressDao userAddressDao;

    @Override
    public ResponseDto<UserAddressDto> findUserAddressByUserIdAndAddressId(Long userId, Long addressId) {
        UserAddressDto userAddressDto = userAddressDao.findUserAddressByUserIdAndAddressId(userId, addressId);
        if (ObjectUtil.isNotNull(userAddressDto)) {
            return ResponseDto.success(userAddressDto);
        }
        return ResponseDto.errorMsg("查不到该用户数据！");
    }
}
